import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {Routes} from '@angular/router';
import {HomeComponent} from './user/page/home/home.component';
import {PageNotFoundComponent} from './user/page/page-not-found/page-not-found.component';
import {AdminHomeComponent} from './admin/page/admin-home/admin-home.component';
import {AdminHomeIndexComponent} from './admin/page/admin-home-index/admin-home-index.component';
import {LoginComponent} from './user/page/login/login.component';
import {IndexComponent} from './user/page/index/index.component';
import {AdminUserComponent} from './admin/page/admin-user/admin-user.component';
import {UserHomeComponent} from './user/page/user-home/user-home.component';
import {UserCenterComponent} from './user/page/user-center/user-center.component';
import {AdminTagComponent} from './admin/page/admin-tag/admin-tag.component';
import {PermissionErrorComponent} from './user/page/permission-error/permission-error.component';
import {ChangePasswordComponent} from './user/page/change-password/change-password.component';
import {ContestRoomComponent} from './contest/page/contest-room/contest-room.component';
import {ContestHomeComponent} from './contest/page/contest-home/contest-home.component';
import {DiscussHomeComponent} from './discuss/page/discuss-home/discuss-home.component';
import {DiscussIndexComponent} from './discuss/page/discuss-index/discuss-index.component';
import {GenerateDiscussComponent} from './discuss/page/generate-discuss/generate-discuss.component';

const routes: Routes = [
  {
    path: '', component: HomeComponent, children: [
      {path: '', component: IndexComponent},
      {path: 'login', component: LoginComponent},
      {
        path: 'user', component: UserHomeComponent, children: [
          {path: '', component: UserCenterComponent},
          {path: 'password', component: ChangePasswordComponent}
        ]
      },
    ]
  },
  {
    path: 'admin', component: AdminHomeComponent, children: [
      {path: '', component: AdminHomeIndexComponent},
      {path: 'user', component: AdminUserComponent},
      {path: 'tag', component: AdminTagComponent}
    ]
  },
  {path: 'login', component: LoginComponent},
  {
    path: 'contestroom', component: ContestHomeComponent, children: [
      {path: '', component: ContestRoomComponent}
    ]
  },
  {
    path: 'discuss', component: DiscussHomeComponent, children: [
      {path: '', component: DiscussIndexComponent},
      {path: 'create', component: GenerateDiscussComponent}
    ]
  },
  {path: 'permision-error', component: PermissionErrorComponent},
  {path: '**', component: PageNotFoundComponent}
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule {
}
